//2744.最大字符串配对数目
//https://leetcode.cn/problems/find-maximum-number-of-string-pairs/?envType=daily-question&envId=2024-01-17
class Solution {
public:
    int maximumNumberOfStringPairs(vector<string>& words) {
        int ret = 0;
        unordered_set<string> hash;
        for(string& s:words) 
        {

            if(hash.size() && hash.count(s))
            {
                hash.erase(s);
                ++ret;
            }
            else
            {
                string tmp(s);
                reverse_copy(s.begin(),s.end(),tmp.begin());
                hash.insert(tmp);
            }
        }
        return ret;
    }
};